package stateDiagram.EntityObjects;

import junit.framework.TestCase;

import org.junit.Test;

import stateDiagram.figures.TransitionFigure;

public class TransitionEntityTest extends TestCase
{
	//same fields as transition entity
	private String _name;
	private StateEntity lastState;
	private StateEntity nextState;
	private TransitionFigure _transitionFigure;
	private TransitionEntity testTransition;
	
	//Test for valid and invalid arguments
	
	//this will run before every test case
	@Override
	protected void setUp() throws Exception
	{
		//any setup which needs to be done in the fields
		_name = "testTrans";
		lastState = new StateEntity("s1", "event", "action");
		nextState = new StateEntity("s2", "event", "action");
		// add transition to the states?
		_name = "testTransition";
		TransitionEntity testTransition = new TransitionEntity(_name,new TransitionFigure());
	}
	//This will run after every test case
	@Override
	protected void tearDown()
	{
		
	}
	// tests the constructor for the TransitionEntityTest
	@Test
	public void testConstructor()
	{
		TransitionEntity testTransition = new TransitionEntity(_name,new TransitionFigure());
		assertEquals(testTransition.getName(),"testTransition");
		
	}
	@Test
	public void testSetName()
	{
		testTransition = new TransitionEntity("bluh", _transitionFigure);
		testTransition.setName("testSetName");
		assertEquals(testTransition.getName(),"testSetName");
	}
	
	@Test //possible changes if we decide to go with state.toXML
	public void testToXML()
	{
		TransitionEntity testTransition = new TransitionEntity("stars",new TransitionFigure());
		assertTrue(testTransition.toXML().contains("<TransitionEvent>stars</TransitionEvent>"));
		testTransition.setName("testingToXML");
		assertTrue(testTransition.toXML().contains("<TransitionEvent>testingToXML</TransitionEvent>"));
		System.out.println(testTransition.toXML());
	}


}
